# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-rake-compiler
_gemname=${pkgname#ruby-}
pkgver=1.2.5
pkgrel=1
pkgdesc="Provide a standard and simplified way to build and package Ruby extensions"
url="https://github.com/rake-compiler/rake-compiler"
arch="noarch"
license="MIT"
depends="ruby ruby-rake"
checkdepends="ruby-rspec"
source="$pkgname-$pkgver.tar.gz::https://github.com/rake-compiler/$_gemname/archive/v$pkgver.tar.gz
	gemfile-remove-unwanted-files.patch"
builddir="$srcdir/$_gemname-$pkgver"
options="!check"  # ruby-rspec is not in main

build() {
	gem build $_gemname.gemspec
}

check() {
	rspec spec
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install --local \
		--install-dir "$gemdir" \
		--bindir "$pkgdir/usr/bin" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and empty directories.
	cd "$gemdir"
	rm -r cache build_info doc
}

sha512sums="
843b9286f874b487f23a3558b0a7565eea5e2a22144a8ece944b4b69d40945eee16cca8341e2ea3678418df7f36637574c6832899215676ca3294ae61b24ff5a  ruby-rake-compiler-1.2.5.tar.gz
2744f66714b893e18491346db8c9691a5bed666ab14281506e4f370dbef2ba640f567deedfd028f3a7b698ab6004af8a2ea20702d72045df833cdbcaf77317a2  gemfile-remove-unwanted-files.patch
"
